import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  // {
  //   title: '发起者',
  //   align: 'center',
  //   dataIndex: 'senderType',
  //   customRender: ({ record }) => {
  //     return record.senderType == 0 ? '用户' : '客服';
  //   },
  // },
  {
    title: '发起者',
    align: 'center',
    dataIndex: 'senderId_dictText',
  },
  // {
  //   title: '接收者ID',
  //   align: 'center',
  //   dataIndex: 'receiveId',
  // },
  {
    title: '消息内容',
    align: 'center',
    dataIndex: 'content',
  },
  // {
  //   title: '是否已读：0-未读 1-已读',
  //   align: 'center',
  //   dataIndex: 'isRead',
  // },
  {
    title: '发起时间',
    align: 'center',
    dataIndex: 'createTime',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '发送者类型：0-用户 1-客服',
    field: 'senderType',
    component: 'InputNumber',
  },
  {
    label: '发送者ID',
    field: 'senderId',
    component: 'Input',
  },
  {
    label: '接收者ID',
    field: 'receiveId',
    component: 'Input',
  },
  {
    label: '消息内容',
    field: 'content',
    component: 'Input',
  },
  {
    label: '是否已读：0-未读 1-已读',
    field: 'isRead',
    component: 'InputNumber',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  status: { title: '状态', order: 0, view: 'number', type: 'number' },
  senderType: { title: '发送者类型：0-用户 1-客服', order: 1, view: 'number', type: 'number' },
  senderId: { title: '发送者ID', order: 2, view: 'text', type: 'string' },
  content: { title: '消息内容', order: 3, view: 'text', type: 'string' },
  isRead: { title: '是否已读：0-未读 1-已读', order: 4, view: 'number', type: 'number' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
